package Q3;
/*
  使用线程池将一个目录中的所有内容拷贝到另外一个目录中，包含子目录中的内容。
*/
import java.io.File;
import java.util.Scanner;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;


public class copyThreadTest {
    public static void main(String[] args) {
        //1.创建一个线程池
        ExecutorService executorService = Executors.newFixedThreadPool(10);
        //2.向线程池中布置任务
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入想要复制的文件地址：");
        String path = sc.next();
        File file = new File(path);
        System.out.println("请输入想要拷贝到的目标地址：");
        String target_path = sc.next();
        executorService.execute(new copyThread(file, target_path));
        //3.关闭线程池
        executorService.shutdown();
    }
}
